package com.yc.hotel.order.feign;

import java.util.List;
import java.util.Map;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.yc.hotel.dto.OrderInfoDTO;

@FeignClient(name="order-server", fallback = IOrderInfoFeignClient.OrderInfoFeignClientFallBack.class)
public interface IOrderInfoFeignClient {
	
	@PostMapping("/orders/check")
	int check(@RequestParam String rno, @RequestParam  String tno, @RequestParam  String status);
	
	@PostMapping("/orders/outOrder")
	int outOrder(@RequestParam String ono, @RequestParam String price);
	
	@PostMapping("/orders/closeOrder")
	int closeOrder(@RequestParam String ono, @RequestParam String rno);
	
	@PostMapping("/orders/update")
	int update(@RequestParam String ono, @RequestParam int status);
	
	@PostMapping("/orders/endSale")
	int endSale(@RequestParam Map<String, Object> map);
	
	@PostMapping("/orders/endRent")
	int endRent(@RequestParam Map<String, Object> map);

	@PostMapping("/orders/finds")
	public List<OrderInfoDTO> finds(@RequestParam Map<String, Object> map);
	
	
	@Component
	public static class OrderInfoFeignClientFallBack implements IOrderInfoFeignClient {

		@Override
		public int check(String rno, String tno, String status) {
			// TODO Auto-generated method stub
			return 0;
		}

		@Override
		public int outOrder(String ono, String price) {
			// TODO Auto-generated method stub
			return 0;
		}

		@Override
		public int closeOrder(String ono, String rno) {
			// TODO Auto-generated method stub
			return 0;
		}

		@Override
		public List<OrderInfoDTO> finds(Map<String, Object> map) {
			// TODO Auto-generated method stub
			return null;
		}

		@Override
		public int update(String ono, int status) {
			// TODO Auto-generated method stub
			return 0;
		}

		@Override
		public int endSale(Map<String, Object> map) {
			// TODO Auto-generated method stub
			return 0;
		}

		@Override
		public int endRent(Map<String, Object> map) {
			// TODO Auto-generated method stub
			return 0;
		}

		
	}
}
